
from processing.model.component import Component
from processing.shape.dynamic_shape import DynamicShape
from processing.shape.drawers import RectDrawer
from processing.shape.static_shape import StaticShape
from processing.shape.description import Description
from processing.shape.color import dark, color, light
from processing.model.flow_component import FlowComponent

class ProcessingKernel(FlowComponent):
    
    def __init__(self):
        FlowComponent.__init__(self)
        self.enter_position(90, 50)
        self.exit_position(90, 20)
        self.x = 100
        self.y = 180
  
    def on_added(self):
        FlowComponent.on_added(self)
        self.running = DynamicShape(self, RectDrawer, [80, 60, 40], [light.blue, color.blue2, color.blue])
        self.stoped  = StaticShape(self, RectDrawer,  [80, 70    ], [color.blue, dark.blue])
        self.render  = self.stoped
        self.add(Description("kernel", 40, 100, color.cyan, 10))

    def update(self):
        FlowComponent.update(self)
        self.render.update()
        
    def draw(self):
        FlowComponent.draw(self)
        self.render.draw()
        
    def stop(self):
        self.render = self.stoped
        
    def run(self):
        self.render = self.running
        
    @property
    def text(self):
        return self.__text
    
     